package com.isyscore.handler;

import com.isyscore.vo.ResponseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: liuxq@isyscore.com
 * @Date: 2021-04-22 17:51:36
 * @Description: 全局异常处理类
 */
@RestControllerAdvice
@Slf4j
@Order(-100)
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public ResponseVo exceptionHandler(Exception e) {
        log.error("请求异常", e);
        return ResponseVo.fail(e.getMessage());
    }

}
